@extends('layouts.admin.application')
@section('content')

    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">私教订单管理</strong> /
                    <small>List</small>
                </div>
            </div>
            @include('admin._flash')
            <hr>

            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-6">
                    <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-s">


                        </div>
                    </div>
                </div>
            </div>
            <div class="am-g"  >
                <div class="am-u-sm-12 am-u-md-12">
                    <form class="am-form-inline" method="get">
                        <div class="am-form-group">
                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field" name="order_no"
                                       value="{{Request::input('order_no')}}" placeholder="订单号搜索">
                            </div>

                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field" name="oncustomer_tel"
                                       value="{{Request::input('oncustomer_tel')}}" placeholder="客户电话搜索">
                            </div>
                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field" name="oncustomer_name"
                                       value="{{Request::input('oncustomer_name')}}" placeholder="客户姓名搜索">
                            </div>

                            <select data-am-selected="{btnSize: 'sm', maxHeight: 360, searchBox: 1}"
                                    name="store_id">
                                <option value="-1">所有门店</option>
                                @foreach($cates as $c)
                                    <option value="{{$c->id}}"
                                            @if(Request::input('store_id')==$c->id) selected @endif>{{$c->name}}</option>
                                @endforeach
                            </select>
                        </div>

                        <div class="am-form-group" style="margin-top: 3px">
                            <button type="submit" class="am-btn am-btn-default am-btn-sm">查询</button>
                            <a href="/admin/order/onbespeakorder" class="am-btn am-btn-default am-btn-sm">重置</a>
                        </div>
                    </form>
                </div>

            </div>
            <hr>


            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main">
                            <thead>
                            <tr style="font-size: 1.6rem">

                                <th class="table-id">ID</th>
                                <th class="table-type">订单号</th>
                                <th class="table-type">客户姓名</th>
                                <th class="table-type">客户手机号</th>

                                <th class="table-type">课程规格</th>
                                <th class="table-type">金额</th>
                                <th class="table-type">上课进度</th>
                                <th class="table-type">教练名称</th>
                                <th class="table-type">下单时间</th>
                                <th class="table-type">上课记录</th>
                                <th class="table-type">所属门店</th>

                                {{--<th class="table-type">是否消费</th>--}}





                                {{--<th class="table-set">操作</th>--}}
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($sjs as  $k=> $s)
                                <tr data-id="111" style="font-size: 1.6rem">

                                    <td>{{$k+1}}</td>
                                    <td>{{$s->order_no}}</td>
                                    <td>
                                        <label class=" am-btn-secondary am-btn am-btn-xs am-radius" >
                                            {{$s['oncustomer_name']}}
                                        </label>
                                    </td>

                                    <td>
                                            {{$s['oncustomer_tel']}}
                                    </td>


                                    <td>
                                        <label class=" am-btn-danger am-btn am-btn-xs am-radius" >
                                            {{$s['bespeak']['name']}}
                                        </label>

                                    </td>

                                    <td>
                                        {{$s->price}}元
                                    </td>

                                    <td>
                                        共{{$s->course_number}}课时完成0课时
                                    </td>
                                    <td>
                                        <label class="am-btn am-btn-secondary am-btn-xs am-radius" >
                                            {{$s['fixfxs']['name']}}
                                        </label>
                                    </td>
                                    <td>
                                        {{$s->created_at}}
                                    </td>
                                    <td>
                                        <a href="/admin/order/classrecord/{{$s->id}}"><label class=" am-btn-danger am-btn am-btn-xs am-radius" >
                                            点击查看
                                        </label></a>
                                    </td>

                                    <td>
                                        <label class=" am-btn-danger am-btn am-btn-xs am-radius" >
                                            {{$s['store']['name']}}
                                        </label>
                                    </td>

                                </tr>
                            @endforeach


                            </tbody>
                        </table>
                        共 {{$sjs->total()}} 条记录

                        <div class="am-cf">
                            <div class="am-fr">
                                {!! $sjs->appends(Request::all())->links() !!}
                            </div>
                        </div>
                        <hr/>
                        <p>注：.....</p>
                    </form>
                </div>

            </div>
        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
        </footer>

    </div>


@endsection
@section('js')
    <script src="/vendor/daterangepicker/moment.js"></script>
    <script src="/vendor/moment/locale/zh-cn.js"></script>
    <script src="/vendor/daterangepicker/daterangepicker.js"></script>

    <script>
        $(function () {
            //改变属性
            $('.change_attr').click(function () {
                var id = $(this).parents('tr').data('id');

                var _this = $(this);
                $.ajax({
                    type: 'PATCH',
                    url: '/admin/onbespeakorder/change_attr',
                    data: {id: id},
                    success: function () {
                        location.href = location.href;
                    }
                })
            })
            //时间插件
            $('#date_start').daterangepicker({

                "autoUpdateInput": false,
                "autoApply": true,
                "locale": {
                    "format": "YYYY-MM-DD",
                    "applyLabel": "确定",
                    "cancelLabel": "取消"
                }
            }, function (start, end, label) {
                this.element[0].value = start.format('YYYY-MM-DD') + ' ~ ' + end.format('YYYY-MM-DD');
            });





        });





    </script>
@endsection